<template>
  <el-row :gutter="14" class="panel-group">
    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <!-- 换图 -->
      <!-- style="display:flex;flex-direction:row;align-items:center" -->
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">专利公开数量</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.total}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">有效专利</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.effectiveTotal}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">有效发明专利</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.effectiveInventionTotal}}</span>
        </div>
      </div>
    </el-col>
    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">高价值专利</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.highScoreTotal}}</span>
        </div>
      </div>
    </el-col>

    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">发明专利授权</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.grantTotal}}</span>
        </div>
      </div>
    </el-col>

    <el-col :xs="4" :sm="4" :lg="4" class="card-panel-col">
      <div class="card-panel" style="display: flex;flex-direction: row;width: 100%">
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 18px;font-weight: bold;color: black">当年发明授权专利</span>
        </div>
        <div style="display: flex;flex:1;justify-content: center;align-items: center">
          <span style="font-size: 30px; color: #3b91b6">{{myData.currentYearGrantTotal}}</span>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
  import CountTo from 'vue-count-to'

  export default {
    components: {
      CountTo
    },
    props: {
      titleObj: {
        type: Object,
        default: {}
      }
    },
    watch: {
      data: {
        handle(newV, oldV) {
          this.myData = newV
        },
        deep: true
      }
    },
    data() {
      return {
        myData: {}
      }
    },
    mounted() {
      setTimeout(() => {
        this.myData = this.titleObj
        // console.log("fff",this.myData)
      }, 500)
    },
    methods: {
      handleSetLineChartData(type) {
        this.$emit('handleSetLineChartData', type)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .panel-group {
    margin-top: 8px;


    .card-panel-col {
      margin-bottom: 24px;
    }


    .card-panel {
      height: 108px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      border-color: rgba(0, 0, 0, .05);

      &:hover {
        .card-panel-icon-wrapper {
          color: #fff;
        }

        .icon-people {
          background: #40c9c6;
        }

        .icon-message {
          background: #36a3f7;
        }

        .icon-money {
          background: #f4516c;
        }

        .icon-shopping {
          background: #34bfa3
        }
      }

      .icon-people {
        color: #40c9c6;
      }

      .icon-message {
        color: #36a3f7;
      }

      .icon-money {
        color: #f4516c;
      }

      .icon-shopping {
        color: #34bfa3
      }

      .card-panel-icon-wrapper {
        float: left;
        // 换图
        margin: 14px 0 0 14px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 48px;
      }

      .card-panel-description {
        float: right;
        font-weight: bold;
        margin: 26px;
        margin-left: 0px;

        .card-panel-text {
          line-height: 18px;
          // color: rgba(0, 0, 0, 0.45);
          color: black;
          font-size: 16px;
          margin-bottom: 12px;
        }

        .card-panel-num {
          font-size: 20px;
        }
      }
    }
  }

  @media (max-width: 550px) {
    .card-panel-description {
      display: none;
    }

    .card-panel-icon-wrapper {
      float: none !important;
      width: 100%;
      height: 100%;
      margin: 0 !important;

      .svg-icon {
        display: block;
        margin: 14px auto !important;
        float: none !important;
      }
    }
  }
</style>
